package com.squapsource.project_euler;

import java.util.HashSet;
import java.util.Set;

import com.squapsource.project_euler.utils.Divisors;

public class Problem23 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Set<Integer> abundants = Divisors.getAbundantNumbers();
		Set<Integer> sumOfAbundants = new HashSet<Integer>();
		for (int abundant : abundants)
		{
			for (int abundant2 : abundants)
			{
				sumOfAbundants.add(abundant+abundant2);
			}
		}
		long sum = 0;
		for (int i = 1; i <= 28123; i++)
		{
			if (!sumOfAbundants.contains(i))
				sum += i;
				
		}
		System.out.println(sum);

	}

}
